/*
 * Copyright (c) 2023 iQi.Co.Ltd. All rights reserved.
 */
 
using IQIGame.Onigao.Framework;
using System.Collections.Generic;
using System.Linq;
using System;
using NetProtocol.Enum;

namespace NetProtocol.POD {

	/// <summary>
	///  请求匹配参数
	/// module : room
	/// </summary>
	public class MatchRequestPOD : IPOD 
    {
        public readonly static Func<MatchRequestPOD> FACTORY = () => new MatchRequestPOD();
		public static Func<MatchRequestPOD> DynamicFactory = FACTORY;
        
		/*-- members --*/
		/// <summary>
        ///  关卡id
        /// </summary>
		public int levelCid;
		
		
		
		/*-- constructors --*/
		public MatchRequestPOD() {}
		public MatchRequestPOD(int levelCid) {
			this.levelCid = levelCid;
		}
		  public void Serial(SOutputStream _out) {
                if(levelCid != default) {
                    _out.WriteByte(1);
                    _out.Write_int(levelCid);
                }
        }
            
        public void UnSerial(SInputStream _in) {
            while (_in.HasRemaining())
            {
                int _key = _in.ReadByte();
                switch (_key)
                {
                    case 1:
                        levelCid = _in.Read_int();
                        break;
                    default: _in.SkipBinary();break;
                }
            }
        }
		
		public MatchRequestPOD Clone() {
            MatchRequestPOD o = DynamicFactory();
            o.levelCid = levelCid;
            return o;
        }
        
        public void Clear() {
            levelCid = default;
        }
		
        public override string ToString() {
			string str = "";
			str += "MatchRequestPOD [";
			str += "levelCid=";
			str += levelCid;
			str += "]";
			return str;
		}
		
	}
}